package com.leonne.harpacristabrasileira.activities;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.RelativeLayout;

import com.leonne.harpacristabrasileira.R;
import com.leonne.harpacristabrasileira.dao.ConfigurationsDAO;
import com.leonne.harpacristabrasileira.tools.MyConstants;

public class HelpActivity extends Activity {

	private RelativeLayout rl;
	private int idAnthem;
	private ConfigurationsDAO dao;
	
	/**
	 * (non-Javadoc)
	 * 
	 * @see android.app.Activity#onCreate(android.os.Bundle)
	 */
	@Override
	public void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
		setContentView(R.layout.help);
        Bundle extras = this.getIntent().getExtras();
		this.idAnthem = extras.getInt("IDANTHEM");
		
		this.dao = new ConfigurationsDAO(this.getBaseContext());
		
		this.rl = (RelativeLayout) findViewById(R.id.rlHelpContent);
		this.rl.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				Intent intent;
				MyConstants.ISFAVORITE = false;
				dao.setFirstTimeOpen(0);
				if (idAnthem == -1) {
					intent = new Intent(HelpActivity.this, FirstPageActivity.class);
					intent.putExtra("FORCESEARCH", false);
				} else {
					intent = new Intent(HelpActivity.this, TextContentPageActivity.class);
					intent.putExtra("IDANTHEM", idAnthem);
				}
	    		startActivity(intent);
				overridePendingTransition(R.anim.fade, R.anim.hold);
			}
		});
	}
}
